#include <iostream>
#include <cstdio>
#define OP min
#define INFINITE 0x3fffffff
#define MAXNUM 1000
using namespace std;
int min(int a, int b) {
    if (a<b) return a;
    else return b;
}
int max(int a, int b) {
    if (a<b) return b;
    else return a;
}
struct SegTreeNode {
    int val;
    int mark;
};
SegTreeNode segTree[MAXNUM];
int arr[MAXNUM];
void build(int root, int st, int en) {
    segTree[root].mark=0;
    if (st==en) {
        segTree[root].val = arr[st];
        return ;
    }
    else {
        int mid=(st+en)/2;
        build(root*2+1, st, mid);
        build(root*2+2, mid+1, en);
        segTree[root].val = OP(segTree[root*2+1].val, segTree[root*2+2].val);
    }
}
void pushDown(int root) {
    if (segTree[root].mark!=0) {
        segTree[root*2+1].mark += segTree[root].mark;
        segTree[root*2+2].mark += segTree[root].mark;
        segTree[root*2+1].val += segTree[root].mark;
        segTree[root*2+2].val += segTree[root].mark;
        segTree[root].mark=0;
    }
}
void update(int root, int sst, int sen, int st, int en, int value) {
    if (sen<st || en<sst) {
        return;
    }
    if (st<=sst && sen<=en) {
        segTree[root].mark += value;
        segTree[root].val += value;
        return;
    }
    pushDown(root);
    int mid=(sst+sen)/2;
    update(root*2+1, sst, mid, st, en, value);
    update(root*2+2, mid+1, sen, st, en, value);
    segTree[root].val = OP(segTree[root*2+1].val, segTree[root*2+2].val);
}
int query(int root, int sst, int sen, int st, int en) {
    if (sen<st || en<sst)
        return INFINITE;
    if (st<=sst && sen<=en) {
        return segTree[root].val;
    }
    pushDown(root);
    int mid=(sst+sen)/2;
    return OP(query(root*2+1, sst, mid, st, en), query(root*2+2, mid+1, sen, st, en));
}
int main() {
    int n;
    cin>>n;
    for (int i=0; i<n; i++) cin>>arr[i];
    build(0,0,n-1);
    for (int i=0; i<16; i++) cout<<segTree[i].val<<' ';
    cout<<endl;
    update(0, 0, n-1, 2, 5, 2);
    cout<<query(0,0,n-1,3,4);
    cout<<endl;
    return 0;
}
